import Taro from '@tarojs/taro'
import { View } from "@tarojs/components"
import GlobalData from "../../global"

export default (props:{url:string; className:any; children:any;}) => {
    const url = props.url
    function navTo() {
        if(!GlobalData.isLogin) {
            Taro.navigateTo({
                url : '/pages/auth/getUserInfo/index?redirect=' + encodeURIComponent(url)
            })
        }else {
            Taro.navigateTo({
                url
            })
        }
    }
    return <>
        <View className={props.className || ''} onClick={navTo}>{props.children}</View>
    </>
}